import axios from '@/libs/api.request';

/**
 * 人员管理 相关接口
 */

// 删除公司/部门
export const departmentDelete = (data) => {
  return axios.request({
    url: '/department/delete',
    method: 'POST',
    data: data
  });
};

// 修改公司/部门
export const departmentEdit = (data) => {
  return axios.request({
    url: '/department/edit',
    method: 'POST',
    data: data
  });
};

// 公司/部门树
export const departmentList = () => {
  return axios.request({
    url: '/department/list',
    method: 'POST'
  });
};

// 保存公司/部门
export const departmentSave = (data) => {
  return axios.request({
    url: '/department/save',
    method: 'POST',
    data: data
  });
};

// 查找公司/部门
export const departmentSearch = (data) => {
  return axios.request({
    url: '/department/search',
    method: 'POST',
    data: data
  });
};

// 新增人员
export const staffAdd = (data) => {
  return axios.request({
    url: '/department/saveUser',
    method: 'POST',
    data: data
  });
};

// 获取角色，岗位list
export const getJobRoleList = (data) => {
  return axios.request({
    url: '/department/viewAdd',
    method: 'POST',
    data: data
  });
};

// 用户list
export const getUserList = (data) => {
  return axios.request({
    url: '/department/searchUser',
    method: 'POST',
    data: data
  });
};

// 用户list
export const getUserListByDepartment = (data) => {
  return axios.request({
    url: '/department/userlist',
    method: 'POST',
    data: data
  });
};

// 用户信息
export const getUserInfo = (data) => {
  return axios.request({
    url: '/department/searchUserByid',
    method: 'POST',
    data: data
  });
};

// 编辑用户
export const editStaffInfo = (data) => {
  return axios.request({
    url: '/department/editUser',
    method: 'POST',
    data: data
  });
};

// 删除用户
export const delUser = (data) => {
  return axios.request({
    url: '/department/delUser',
    method: 'POST',
    data: data
  });
};

// 冻结用户 解冻
export const frozenAccount = (data) => {
  return axios.request({
    url: '/department/frozenAccount',
    method: 'POST',
    data: data
  });
};
// 查询用户签名
export const getUserSign = (userId) => {
  return axios.request({
    url: `/getUser?userId=${userId}`,
    method: 'GET'
  });
};
// 保存用户签名
export const saveUserSign = (data) => {
  return axios.request({
    url: `/identifyUser`,
    method: 'POST',
    data
  });
};

// 重置密码
export const resetPassword = (data) => {
  return axios.request({
    url: '/department/resetPassword',
    method: 'POST',
    data: data
  });
};
// 切换认证状态
export const switchStatus = (userId) => {
  return axios.request({
    url: `/userStatus?userId=${userId}`,
    method: 'GET'
  });
};
